import {
  Controller,
  Get, Query,
} from '@nestjs/common';
import { ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger';
import { CarouselService } from './carousel.service';
import { CarouselAllResult } from "@/module/carousel/carousel.result";
import { CarouselAllDto } from "@/module/carousel/carousel.dto";

@Controller('/v1/carousels')
@ApiTags('轮播图')
export class CarouselV1Controller {
  constructor(private readonly carouselService: CarouselService) {
  }

  @Get('/all')
  @ApiOperation({ summary: '全部轮播' })
  @ApiOkResponse({ type: CarouselAllResult, isArray: true })
  async all(@Query() query: CarouselAllDto): Promise<CarouselAllResult[]> {
    const res = await this.carouselService.all(query);
    return res;
  }
}
